import { MenuType } from 'src/constants';
import { ISchemaInfo } from 'src/components/QueryForm';
import { Icon } from 'src/components/Icons';

export const schema: ISchemaInfo[] = [
  // {
  //   name: 'parentId',
  //   label: '父级菜单ID',
  //   component: 'Input',
  //   componentProps: {
  //     placeholder: '请输入父级菜单ID',
  //   },
  // },
  {
    name: 'menuName',
    label: '菜单名称',
    component: 'Input',
    componentProps: {
      placeholder: '请输入菜单名称',
    },
  },
  {
    name: 'menuType',
    label: '菜单类型',
    component: 'Select',
    componentProps: {
      placeholder: '请选择菜单类型',
      options: MenuType,
      allowClear: true,
      style: {
        width: '100%',
      },
    },
  },
];

export const columns = [
  {
    title: '菜单名称',
    dataIndex: 'name',
    key: 'name',
    width: 200,
  },
  {
    title: '菜单路径',
    dataIndex: 'path',
    key: 'path',
    width: 200,
  },
  {
    title: '菜单类型',
    dataIndex: 'menuType',
    key: 'menuType',
    render: (text: number) => {
      return MenuType.filter((item) => item.value === text)[0]?.label;
    },
    width: 100,
  },
  {
    title: '图标',
    dataIndex: 'icon',
    key: 'icon',
    render: (text: string) => {
      return <Icon name={text} size={24} />;
    },
    width: 50,
  },
  {
    title: '排序',
    dataIndex: 'sortOrder',
    key: 'sortOrder',
    width: 50,
  },
  {
    title: '国际化标识',
    dataIndex: 'locale',
    key: 'locale',
    width: 150,
  },
  {
    title: '权限标识',
    dataIndex: 'permission',
    key: 'permission',
    width: 200,
  },
  {
    title: '创建时间',
    dataIndex: 'createTime',
    key: 'createTime',
    width: 200,
  },
];
